package com.ruoyi.web.easytron.util;
/**
 * 进制转换
 */
public class BaseConvert {

    /**
     * 转16进制补零
     *
     * @param value 10 进制
     * @return 16
     */
    public static String toBase16StringWithZero(long value) {
        String blockIdStart = Long.toHexString(value);
        String zero="0";
        //String zeros = zero.repeat(16 - blockIdStart.length());
        int repeatCount = 16 - blockIdStart.length();
        StringBuilder zerosBuilder = new StringBuilder();

        for (int i = 0; i < repeatCount; i++) {
            zerosBuilder.append(zero);
        }

        String zeros = zerosBuilder.toString();

        return zeros + blockIdStart;
    }
}
